package com.hmall.cart.controller.inner;

import com.hmall.api.cart.CartClient;
import com.hmall.cart.service.ICartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 无状态调用的购物车接口
 *
 * @Author wd
 * @Date 2025/6/20 16:19
 */
@Api(tags = "购物车相关接口")
@RestController
@RequestMapping("/carts/inner")
@RequiredArgsConstructor
@Slf4j
public class CartInnerController implements CartClient {

    private final ICartService cartService;

    @ApiOperation("批量删除购物车中商品")
    @ApiImplicitParam(name = "ids", value = "购物车条目id集合")
    @Override
    @DeleteMapping
    public void deleteCartItemByIds(@RequestParam("userId")Long userId , @RequestParam("ids") List<Long> ids){
        cartService.removeByItemIds(userId, ids);
    }

}